﻿using GHI.Glide;
using GHI.Glide.Display;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using PJE.GlideEx.UI;


namespace ScrollBarTest
{
	public partial class Program
	{
		private Window _window;
		private ScrollBar _scrollBar0;

		void ProgramStarted()
		{
			Debug.Print("Program Started");

			GlideTouch.Initialize();

			var sy = new[]
			{
				(short)136, (short)26, (short)246, (short)246, (short)26
			};

			var sx = new[]
			{
				(short)240,(short)48,(short)48,(short)432,(short)432
			};

			var cy = new[]
			{
				(short)482,(short)140,(short)815,(short)754,(short)176
			};

			var cx = new[]
			{
				(short)471,(short)99,(short)139,(short)830,(short)856
			};

			Touch.ActiveTouchPanel.SetCalibration(5, sx, sy, cx, cy);

			_window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window));

			_scrollBar0 = new ScrollBar("sb0", 255, 0, 0, 32, 272) { Maximum = 2720 };

			_window.AddChild(_scrollBar0);

			Glide.MainWindow = _window;
			_scrollBar0.ValueChangedEventHandler += _scrollBar0_ValueChangedEventHandler;
		}

		void _scrollBar0_ValueChangedEventHandler(ValueChangedEventArgs e)
		{
			Debug.Print("Value: " + e.Value);
		}
	}
}
